<html>
<head><meta charset="utf-8"><title>TAIT PR #82558 · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html">TAIT PR #82558</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="238445017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238445017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238445017">(May 12 2021 at 09:20)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="124288">@oli</span> -- I was looking at <a href="https://github.com/rust-lang/rust/pull/82558">https://github.com/rust-lang/rust/pull/82558</a> again, and I am wondering whether you would like to hand it off to <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> or <span class="user-mention" data-user-id="218805">@Mark Drobnak</span> (or someone else, but they were at the wg-traits meeting yesterday)? Also, you two, I'm wondering whether you'd like to arrange a time to discuss it later today.</p>



<a name="238461007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238461007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238461007">(May 12 2021 at 11:54)</a>:</h4>
<p>Yea, I'd be happy to pass it on and just do some mentoring</p>



<a name="238478692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238478692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238478692">(May 12 2021 at 14:03)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/238445017">said</a>:</p>
<blockquote>
<p>Hey <span class="user-mention silent" data-user-id="124288">oli</span> -- I was looking at <a href="https://github.com/rust-lang/rust/pull/82558">https://github.com/rust-lang/rust/pull/82558</a> again, and I am wondering whether you would like to hand it off to <span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> or <span class="user-mention silent" data-user-id="218805">Mark Drobnak</span> (or someone else, but they were at the wg-traits meeting yesterday)? Also, you two, I'm wondering whether you'd like to arrange a time to discuss it later today.</p>
</blockquote>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I can take this one and talk with <span class="user-mention" data-user-id="124288">@oli</span> about it</p>



<a name="238484651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238484651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238484651">(May 12 2021 at 14:38)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> if you have time later today we can sync about it</p>



<a name="238484726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238484726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238484726">(May 12 2021 at 14:39)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/238484651">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> if you have time later today we can sync about it</p>
</blockquote>
<p>sure, do you want to schedule some time now?</p>



<a name="238485002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238485002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238485002">(May 12 2021 at 14:40)</a>:</h4>
<p>yep. maybe <time datetime="2021-05-12T18:30:00Z">2021-05-12T14:30:00-04:00</time> ?</p>



<a name="238488201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238488201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238488201">(May 12 2021 at 14:59)</a>:</h4>
<p>let's coordinate on PM</p>



<a name="238488286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238488286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238488286">(May 12 2021 at 14:59)</a>:</h4>
<p>that's ok</p>



<a name="238523631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238523631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238523631">(May 12 2021 at 18:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> ping</p>



<a name="238524065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238524065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238524065">(May 12 2021 at 18:42)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="238524162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238524162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238524162">(May 12 2021 at 18:43)</a>:</h4>
<p>do you want a zoom call or just have a chat here?</p>



<a name="238525585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525585">(May 12 2021 at 18:52)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> sorry, missied you ping</p>



<a name="238525600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525600">(May 12 2021 at 18:52)</a>:</h4>
<p>well, I'm game for either kind</p>



<a name="238525613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525613">(May 12 2021 at 18:52)</a>:</h4>
<p>i've been doing a lot of zoom, so maybe we try Zulip?</p>



<a name="238525628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525628">(May 12 2021 at 18:52)</a>:</h4>
<p>yeah, whatever you prefer is ok to me</p>



<a name="238525646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525646">(May 12 2021 at 18:52)</a>:</h4>
<p>so...</p>



<a name="238525738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525738">(May 12 2021 at 18:53)</a>:</h4>
<p>I didn't look at the PR, was checking the issue and yeah, it's bad :)</p>



<a name="238525785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525785">(May 12 2021 at 18:53)</a>:</h4>
<p>so</p>



<a name="238525799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525799">(May 12 2021 at 18:53)</a>:</h4>
<p>I'm trying to decide where to start :)</p>



<a name="238525806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525806">(May 12 2021 at 18:53)</a>:</h4>
<p>so no idea why happens but if I understood correctly we end with a <code>A: 'static</code> and the compiler accepts that regardless what's in A is a String, not even a reference</p>



<a name="238525807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525807">(May 12 2021 at 18:53)</a>:</h4>
<p>I guess i can explain what the PR is doing</p>



<a name="238525885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525885">(May 12 2021 at 18:54)</a>:</h4>
<p>along the way, we'll have to explain a bit about how this whole setup works</p>



<a name="238525917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525917">(May 12 2021 at 18:54)</a>:</h4>
<p>might be good for rustc-dev-guide, if it's not already covered :)</p>



<a name="238525932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525932">(May 12 2021 at 18:54)</a>:</h4>
<p>well yeah, I was starting from the what's the problem :)</p>



<a name="238525944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525944">(May 12 2021 at 18:54)</a>:</h4>
<p>example:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">type</span> <span class="nc">X</span><span class="o">&lt;</span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Into</span><span class="o">&lt;&amp;'</span><span class="nb">static</span><span class="w"> </span><span class="n">A</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">f</span><span class="o">&lt;</span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span>: <span class="o">'</span><span class="nb">static</span><span class="o">&gt;</span><span class="p">(</span><span class="n">a</span>: <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="nc">A</span><span class="p">,</span><span class="w"> </span><span class="n">b</span>: <span class="nc">B</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="p">(</span><span class="n">X</span><span class="o">&lt;</span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">X</span><span class="o">&lt;</span><span class="n">B</span><span class="p">,</span><span class="w"> </span><span class="n">A</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="o">....</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="238525967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525967">(May 12 2021 at 18:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/238525806">said</a>:</p>
<blockquote>
<p>so no idea why happens but if I understood correctly we end with a <code>A: 'static</code> and the compiler accepts that regardless what's in A is a String, not even a reference</p>
</blockquote>
<p>I guess the problem is <span aria-label="point up" class="emoji emoji-1f446" role="img" title="point up">:point_up:</span></p>



<a name="238525977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238525977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238525977">(May 12 2021 at 18:55)</a>:</h4>
<p>but maybe best to start with a simpler one before we go deep</p>



<a name="238526055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526055">(May 12 2021 at 18:55)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">type</span> <span class="nc">X</span><span class="o">&lt;</span><span class="n">A</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Into</span><span class="o">&lt;</span><span class="n">A</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">X</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="238526099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526099">(May 12 2021 at 18:55)</a>:</h4>
<p>I wanted to talk about how the inference and logic works in this example</p>



<a name="238526215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526215">(May 12 2021 at 18:56)</a>:</h4>
<p>the idea is that <code>impl Into&lt;A&gt;</code> in that position 'desugars' into a kind of 'existential type', right? something whose value must be inferred</p>



<a name="238526308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526308">(May 12 2021 at 18:56)</a>:</h4>
<p>so you can sort of imagine that you have, after inference:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">type</span> <span class="nc">X</span><span class="o">&lt;</span><span class="n">A</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">A</span><span class="p">;</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">X</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="238526338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526338">(May 12 2021 at 18:57)</a>:</h4>
<p>you can verify for yourself that this should type check :)</p>



<a name="238526434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526434">(May 12 2021 at 18:57)</a>:</h4>
<p>yep</p>



<a name="238526704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526704">(May 12 2021 at 18:59)</a>:</h4>
<p>ok</p>



<a name="238526716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526716">(May 12 2021 at 18:59)</a>:</h4>
<p>so note something interesting there</p>



<a name="238526724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526724">(May 12 2021 at 18:59)</a>:</h4>
<p>you can't just take the type from the return type and paste it in</p>



<a name="238526733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526733">(May 12 2021 at 18:59)</a>:</h4>
<p>i.e., we translated <code>T</code> to <code>A</code></p>



<a name="238526830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526830">(May 12 2021 at 19:00)</a>:</h4>
<p>in particular: when we type-checked the function, we inferred that the hidden type was <code>T</code></p>



<a name="238526908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526908">(May 12 2021 at 19:00)</a>:</h4>
<p>and then we "translated that" to be in terms of the generic arguments that the user declared on the <code>type X&lt;A&gt; = impl into&lt;A&gt;</code></p>



<a name="238526923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526923">(May 12 2021 at 19:00)</a>:</h4>
<p>right?</p>



<a name="238526977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526977">(May 12 2021 at 19:00)</a>:</h4>
<p>somewhat more detailed:</p>



<a name="238526980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238526980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238526980">(May 12 2021 at 19:00)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/238526724">said</a>:</p>
<blockquote>
<p>you can't just take the type from the return type and paste it in</p>
</blockquote>
<p>unsure what you meant here</p>



<a name="238527003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527003">(May 12 2021 at 19:00)</a>:</h4>
<p>well, let me explain it in terms of the implementation</p>



<a name="238527031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527031">(May 12 2021 at 19:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/238526830">said</a>:</p>
<blockquote>
<p>in particular: when we type-checked the function, we inferred that the hidden type was <code>T</code></p>
</blockquote>
<p>right</p>



<a name="238527058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527058">(May 12 2021 at 19:01)</a>:</h4>
<p>when we type check <code>fn foo</code>, we note that the return type includes a reference to a TAIT (type alias impl trait) <code>X&lt;T&gt;</code></p>



<a name="238527074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527074">(May 12 2021 at 19:01)</a>:</h4>
<p>we replace that with a type variable <code>?X</code></p>



<a name="238527090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527090">(May 12 2021 at 19:01)</a>:</h4>
<p>so that the return type the fn body sees is <code>?X</code></p>



<a name="238527098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527098">(May 12 2021 at 19:01)</a>:</h4>
<p>then we type-check the function</p>



<a name="238527123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527123">(May 12 2021 at 19:01)</a>:</h4>
<p>this will result in a constraint that <code>T &lt;: ?X</code> -- because the returned value <code>x</code> is of type <code>T</code></p>



<a name="238527135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527135">(May 12 2021 at 19:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/238526308">said</a>:</p>
<blockquote>
<p>so you can sort of imagine that you have, after inference:</p>
<p><div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">type</span> <span class="nc">X</span><span class="o">&lt;</span><span class="n">A</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">A</span><span class="p">;</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">X</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div><br>
</p>
</blockquote>
<p>are you talking about this example or the previous one? because in this one there's no TAIT</p>



<a name="238527151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527151">(May 12 2021 at 19:02)</a>:</h4>
<p>the previous one</p>



<a name="238527191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527191">(May 12 2021 at 19:02)</a>:</h4>
<p>that example is the end result</p>



<a name="238527198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527198">(May 12 2021 at 19:02)</a>:</h4>
<p>i'm talking about the input</p>



<a name="238527203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527203">(May 12 2021 at 19:02)</a>:</h4>
<p>ahh now things make sense :)</p>



<a name="238527251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527251">(May 12 2021 at 19:02)</a>:</h4>
<p>right, so now we have to compute what is the "hidden type" for <code>X&lt;A&gt;</code></p>



<a name="238527282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527282">(May 12 2021 at 19:02)</a>:</h4>
<p>and we have one instance of it (<code>T</code>) for <code>X&lt;T&gt;</code></p>



<a name="238527369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527369">(May 12 2021 at 19:03)</a>:</h4>
<p>so there is some code that kind of does this reverse mapping: we see that the first argument is <code>T</code>, and we replace every instance of <code>T</code> with the corresponding generic parameter (<code>A</code>)</p>



<a name="238527377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527377">(May 12 2021 at 19:03)</a>:</h4>
<p>sort of the obvious thing your brain does automatically</p>



<a name="238527422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527422">(May 12 2021 at 19:03)</a>:</h4>
<p>right</p>



<a name="238527486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527486">(May 12 2021 at 19:04)</a>:</h4>
<p>but this can be a bit tricky in some edge cases</p>



<a name="238527491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527491">(May 12 2021 at 19:04)</a>:</h4>
<p>consider this:</p>



<a name="238527535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527535">(May 12 2021 at 19:04)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">type</span> <span class="nc">X</span><span class="o">&lt;</span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Sized</span><span class="p">;</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">X</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="238527571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527571">(May 12 2021 at 19:04)</a>:</h4>
<p>what is the hidden type?</p>



<a name="238527586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527586">(May 12 2021 at 19:04)</a>:</h4>
<p>it could be either <code>A</code> <em>or</em> <code>B</code></p>



<a name="238527622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527622">(May 12 2021 at 19:05)</a>:</h4>
<p>right</p>



<a name="238527851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527851">(May 12 2021 at 19:06)</a>:</h4>
<p>so the answer is: we make that illegal</p>



<a name="238527863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527863">(May 12 2021 at 19:06)</a>:</h4>
<p>there's a similar problem with something like</p>



<a name="238527876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527876">(May 12 2021 at 19:06)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">X</span><span class="o">&lt;</span><span class="kt">u32</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="mi">22_</span><span class="k">u32</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="238527914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527914">(May 12 2021 at 19:07)</a>:</h4>
<p>now, is it <code>type X&lt;A&gt; = u32</code> or is it <code>type X&lt;A&gt; = A</code></p>



<a name="238527922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527922">(May 12 2021 at 19:07)</a>:</h4>
<p>both would work</p>



<a name="238527948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527948">(May 12 2021 at 19:07)</a>:</h4>
<p>so we make that illegal too</p>



<a name="238527952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238527952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238527952">(May 12 2021 at 19:07)</a>:</h4>
<p>the rules are specifically:</p>



<a name="238528010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528010">(May 12 2021 at 19:07)</a>:</h4>
<ul>
<li>when you have a 'defining use' (i.e., a use from which we will infer the hidden type) of a TAIT, the generic arguments to that TAIT must all be unique generic arguments from the surrounding scope</li>
</ul>



<a name="238528159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528159">(May 12 2021 at 19:08)</a>:</h4>
<p>so <code>fn foo&lt;T, U&gt;() -&gt; X&lt;T, U&gt;</code> is ok because the generic arguments to the TAIT <code>X</code> are <code>T</code> and <code>U</code>, which:</p>
<ul>
<li>are both generic parameters of the surrounding function</li>
<li>are different from one another</li>
</ul>



<a name="238528178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528178">(May 12 2021 at 19:08)</a>:</h4>
<p>you're not allowed to do <code>X&lt;u32, U&gt;</code>, etc</p>



<a name="238528203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528203">(May 12 2021 at 19:08)</a>:</h4>
<p>ok, that was a kind of general explanation</p>



<a name="238528213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528213">(May 12 2021 at 19:09)</a>:</h4>
<p>this particular thing is called "higher order pattern unification"</p>



<a name="238528240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528240">(May 12 2021 at 19:09)</a>:</h4>
<p>that is: inferring a generic type (something with type parameters, like <code>X&lt;T&gt;</code>) from examples, subject to that given limitation</p>



<a name="238528290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528290">(May 12 2021 at 19:09)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/238528178">said</a>:</p>
<blockquote>
<p>you're not allowed to do <code>X&lt;u32, U&gt;</code>, etc</p>
</blockquote>
<p>you said this don't because U includes u32, I guess</p>



<a name="238528360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528360">(May 12 2021 at 19:10)</a>:</h4>
<p>because <code>u32</code> is not a generic type parameter from the surrounding context</p>



<a name="238528399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528399">(May 12 2021 at 19:10)</a>:</h4>
<p>ok</p>



<a name="238528407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528407">(May 12 2021 at 19:10)</a>:</h4>
<p>the reason that is disallowd is that you can't tell whether it shoud just appear as <em>itself</em> in the genreic form</p>



<a name="238528417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528417">(May 12 2021 at 19:10)</a>:</h4>
<p>or as a reference to the first parameter <code>A</code></p>



<a name="238528493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528493">(May 12 2021 at 19:10)</a>:</h4>
<p>it's kind of magic to me now the why of those rules but ok :)</p>



<a name="238528535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528535">(May 12 2021 at 19:11)</a>:</h4>
<p>basically: the general case is ambiguous</p>



<a name="238528543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528543">(May 12 2021 at 19:11)</a>:</h4>
<p>these rules make it unambiguous</p>



<a name="238528561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528561">(May 12 2021 at 19:11)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="238528583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528583">(May 12 2021 at 19:11)</a>:</h4>
<p>you can imagine other rules perhaps, but these are "decent ones" :)</p>



<a name="238528604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528604">(May 12 2021 at 19:11)</a>:</h4>
<p>hehe :)</p>



<a name="238528831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528831">(May 12 2021 at 19:13)</a>:</h4>
<p>anyway so</p>



<a name="238528837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238528837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238528837">(May 12 2021 at 19:13)</a>:</h4>
<p><em>this bug</em></p>



<a name="238529018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529018">(May 12 2021 at 19:14)</a>:</h4>
<p>is about code that doesn't follow the rules :)</p>



<a name="238529269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529269">(May 12 2021 at 19:16)</a>:</h4>
<p>well</p>



<a name="238529277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529277">(May 12 2021 at 19:16)</a>:</h4>
<p>the code is actually reasonable</p>



<a name="238529291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529291">(May 12 2021 at 19:16)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/238525944">said</a>:</p>
<blockquote>
<p>example:</p>
<p><div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">type</span> <span class="nc">X</span><span class="o">&lt;</span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Into</span><span class="o">&lt;&amp;'</span><span class="nb">static</span><span class="w"> </span><span class="n">A</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">f</span><span class="o">&lt;</span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span>: <span class="o">'</span><span class="nb">static</span><span class="o">&gt;</span><span class="p">(</span><span class="n">a</span>: <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="nc">A</span><span class="p">,</span><span class="w"> </span><span class="n">b</span>: <span class="nc">B</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="p">(</span><span class="n">X</span><span class="o">&lt;</span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">X</span><span class="o">&lt;</span><span class="n">B</span><span class="p">,</span><span class="w"> </span><span class="n">A</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="o">....</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div><br>
</p>
</blockquote>



<a name="238529299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529299">(May 12 2021 at 19:16)</a>:</h4>
<p>there are <em>two</em> uses of <code>X</code> there</p>



<a name="238529302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529302">(May 12 2021 at 19:16)</a>:</h4>
<p><em>but</em></p>



<a name="238529309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529309">(May 12 2021 at 19:17)</a>:</h4>
<p>each use of <code>X</code> follows the rules:</p>



<a name="238529326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529326">(May 12 2021 at 19:17)</a>:</h4>
<ul>
<li>it references only generic parameters from <code>f</code></li>
</ul>



<a name="238529341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529341">(May 12 2021 at 19:17)</a>:</h4>
<ul>
<li>it references distinct generic parameters from <code>f</code></li>
</ul>



<a name="238529362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529362">(May 12 2021 at 19:17)</a>:</h4>
<p>the bug is that we don't recognize that there are  two distinct uses of <code>X</code></p>



<a name="238529392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529392">(May 12 2021 at 19:17)</a>:</h4>
<p>what we do today is to create <em>one</em> underlying inference variable (<code>?X</code>)</p>



<a name="238529407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529407">(May 12 2021 at 19:17)</a>:</h4>
<p>ohh I see</p>



<a name="238529518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529518">(May 12 2021 at 19:18)</a>:</h4>
<p>and then we just kind of ignore one of the uses</p>



<a name="238529530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529530">(May 12 2021 at 19:18)</a>:</h4>
<p>the fix that <span class="user-mention" data-user-id="124288">@oli</span> did is to detect and report an error</p>



<a name="238529536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529536">(May 12 2021 at 19:18)</a>:</h4>
<p>but we can do better</p>



<a name="238529548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529548">(May 12 2021 at 19:18)</a>:</h4>
<p>we can just treat each use separately</p>



<a name="238529677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529677">(May 12 2021 at 19:19)</a>:</h4>
<p>so</p>



<a name="238529694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529694">(May 12 2021 at 19:19)</a>:</h4>
<p>I tried to be smart, but that caused a lot of fallout. In hindsight the solution proposed by Niko is obvious</p>



<a name="238529701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529701">(May 12 2021 at 19:20)</a>:</h4>
<p>in that case we would have <code>?X1</code> and <code>?X2</code></p>



<a name="238529922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529922">(May 12 2021 at 19:21)</a>:</h4>
<p>yeah <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="238529973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238529973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238529973">(May 12 2021 at 19:22)</a>:</h4>
<p>so in the PR itself...</p>



<a name="238530150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238530150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238530150">(May 12 2021 at 19:23)</a>:</h4>
<p>currently we have a map</p>



<a name="238530600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238530600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238530600">(May 12 2021 at 19:27)</a>:</h4>
<p>a vec I think but yeah</p>



<a name="238530794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238530794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238530794">(May 12 2021 at 19:29)</a>:</h4>
<p>yeah sorry I got distracte</p>



<a name="238530806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238530806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238530806">(May 12 2021 at 19:29)</a>:</h4>
<p>anyway the idea is to extend the key to include the substs</p>



<a name="238530814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238530814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238530814">(May 12 2021 at 19:29)</a>:</h4>
<p>my belief is that because of the above rules</p>



<a name="238530821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238530821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238530821">(May 12 2021 at 19:29)</a>:</h4>
<p>the substs should never have inference variables</p>



<a name="238530831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238530831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238530831">(May 12 2021 at 19:29)</a>:</h4>
<p>or the other kinds of things that make <code>Ty</code> unsuitable for use as a hashmap key</p>



<a name="238530899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238530899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238530899">(May 12 2021 at 19:30)</a>:</h4>
<p>the function: <a href="https://github.com/rust-lang/rust/blob/93f3d0867ed9a1ad343356955c314b3df8fd99f0/compiler/rustc_trait_selection/src/opaque_types.rs">https://github.com/rust-lang/rust/blob/93f3d0867ed9a1ad343356955c314b3df8fd99f0/compiler/rustc_trait_selection/src/opaque_types.rs</a></p>



<a name="238531346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238531346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238531346">(May 12 2021 at 19:33)</a>:</h4>
<p>when you've said a map, were you referring to <code>OpaqueTypeMap</code>?</p>



<a name="238531526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238531526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238531526">(May 12 2021 at 19:34)</a>:</h4>
<p>anyway, I need to read a bit the code to understand better what's going on :)</p>



<a name="238541578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238541578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238541578">(May 12 2021 at 20:45)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> <a href="https://github.com/rust-lang/rust/pull/82558/files#diff-98923b31651a0150fc5eae47f5ceb44f716b521762db4e37cf9292dac7b3e040R1104">this map</a> </p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">        </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">opaque_defn</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">opaque_types</span><span class="p">.</span><span class="n">get_mut</span><span class="p">(</span><span class="o">&amp;</span><span class="n">def_id</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
</code></pre></div>



<a name="238541693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238541693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238541693">(May 12 2021 at 20:46)</a>:</h4>
<p>right, that's the <code>OpaqueTypeMap</code> thing <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="238542719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238542719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238542719">(May 12 2021 at 20:54)</a>:</h4>
<p>thanks Niko, will take a look at this tomorrow</p>



<a name="238544977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/238544977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#238544977">(May 12 2021 at 21:09)</a>:</h4>
<p>great</p>



<a name="239511798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239511798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239511798">(May 19 2021 at 23:38)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <a href="https://github.com/spastorino/rust/tree/tait-soundness-bug">https://github.com/spastorino/rust/tree/tait-soundness-bug</a></p>



<a name="239589856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239589856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239589856">(May 20 2021 at 13:21)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/239511798">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="https://github.com/spastorino/rust/tree/tait-soundness-bug">https://github.com/spastorino/rust/tree/tait-soundness-bug</a></p>
</blockquote>
<p>was chatting with Niko on DM about this yesterday, but going to share a summary of what's going on</p>



<a name="239590074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239590074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239590074">(May 20 2021 at 13:23)</a>:</h4>
<p>basically the code in that branch modifies the opaque type mapping to have as key <code>Ty&lt;'tcx&gt;</code> instead of <code>DefId</code></p>



<a name="239590122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239590122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239590122">(May 20 2021 at 13:23)</a>:</h4>
<p><a href="https://github.com/spastorino/rust/commit/45e088374f6398b674f418aa4687cfb35348d2b3#diff-fac6fe2f0c52a383e90c95577bf3646f2e9e17a4c9271e54b3035a888f5d0f1aR219">https://github.com/spastorino/rust/commit/45e088374f6398b674f418aa4687cfb35348d2b3#diff-fac6fe2f0c52a383e90c95577bf3646f2e9e17a4c9271e54b3035a888f5d0f1aR219</a> and <a href="https://github.com/spastorino/rust/commit/45e088374f6398b674f418aa4687cfb35348d2b3#diff-98923b31651a0150fc5eae47f5ceb44f716b521762db4e37cf9292dac7b3e040R31">https://github.com/spastorino/rust/commit/45e088374f6398b674f418aa4687cfb35348d2b3#diff-98923b31651a0150fc5eae47f5ceb44f716b521762db4e37cf9292dac7b3e040R31</a></p>



<a name="239590178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239590178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239590178">(May 20 2021 at 13:23)</a>:</h4>
<p>we wanted instead of <code>DefId</code>, <code>DefId</code> + <code>SubstsRef</code></p>



<a name="239590315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239590315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239590315">(May 20 2021 at 13:24)</a>:</h4>
<p>my first approach was to try to use a pair of those but I was hitting issues because given that that's now the key of a <code>FxHashMap</code> it needs to implement <code>HashStable</code> and possibly <code>ToStableHashKey</code></p>



<a name="239590371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239590371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239590371">(May 20 2021 at 13:25)</a>:</h4>
<p>Niko suggested me to use <code>Ty</code>, in particular the <code>Opaque</code> variant of it that's composed of <code>DefId</code> and <code>SubstsRef</code></p>



<a name="239590395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239590395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239590395">(May 20 2021 at 13:25)</a>:</h4>
<p>I'm getting this compilation error ...</p>



<a name="239590451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239590451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239590451">(May 20 2021 at 13:25)</a>:</h4>
<div class="codehilite"><pre><span></span><code>= note: the following trait bounds were not satisfied:
            `&amp;TyS&lt;&#39;_&gt;: ToStableHashKey&lt;_&gt;`
            which is required by `HashMap&lt;&amp;TyS&lt;&#39;_&gt;, ResolvedOpaqueTy&lt;&#39;_&gt;, BuildHasherDefault&lt;FxHasher&gt;&gt;: HashStable&lt;_&gt;`
</code></pre></div>



<a name="239590567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239590567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239590567">(May 20 2021 at 13:26)</a>:</h4>
<p>so, I'd need to implement <code>ToStableHashKey</code></p>



<a name="239590703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239590703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239590703">(May 20 2021 at 13:27)</a>:</h4>
<p>so ... right now I'm not sure how using <code>Ty</code> there instead of <code>DefId, SubstsRef</code> pair is any better because I end, having to implement these traits (<code>HashStable</code> and <code>ToStableHashKey</code>) for the pair but also for the rest of the other variants that are not <code>Opaque</code></p>



<a name="239663847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239663847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239663847">(May 20 2021 at 21:41)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> I finally have a chance to look at this</p>



<a name="239664184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239664184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239664184">(May 20 2021 at 21:44)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> no worries, I’ll be with the computer in 5 minutes</p>



<a name="239664838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239664838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239664838">(May 20 2021 at 21:50)</a>:</h4>
<p>so</p>



<a name="239664842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239664842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239664842">(May 20 2021 at 21:50)</a>:</h4>
<p>hmm</p>



<a name="239664848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239664848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239664848">(May 20 2021 at 21:50)</a>:</h4>
<p>I see the probelm :)</p>



<a name="239664864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239664864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239664864">(May 20 2021 at 21:50)</a>:</h4>
<p>I guess there are no maps with types as keys</p>



<a name="239664865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239664865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239664865">(May 20 2021 at 21:50)</a>:</h4>
<p>which is interesing</p>



<a name="239664875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239664875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239664875">(May 20 2021 at 21:50)</a>:</h4>
<p>perhaps we <em>will</em> have to implement stable hash or whatever</p>



<a name="239664932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239664932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239664932">(May 20 2021 at 21:51)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yeah</p>



<a name="239664955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239664955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239664955">(May 20 2021 at 21:51)</a>:</h4>
<p>I see this impl that you added:</p>



<a name="239664956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239664956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239664956">(May 20 2021 at 21:51)</a>:</h4>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gi">+impl&lt;'a, 'tcx&gt; ToStableHashKey&lt;StableHashingContext&lt;'a&gt;&gt; for TyS&lt;'tcx&gt; {</span>
<span class="gi">+    type KeyType = Fingerprint;</span>
<span class="gi">+</span>
<span class="gi">+    #[inline]</span>
<span class="gi">+    fn to_stable_hash_key(&amp;self, hcx: &amp;StableHashingContext&lt;'a&gt;) -&gt; Fingerprint {</span>
<span class="gi">+        let ty::TyS {</span>
<span class="gi">+            ref kind,</span>
<span class="gi">+</span>
<span class="gi">+            // The other fields just provide fast access to information that is</span>
<span class="gi">+            // also contained in `kind`, so no need to hash them.</span>
<span class="gi">+            flags: _,</span>
<span class="gi">+</span>
<span class="gi">+            outer_exclusive_binder: _,</span>
<span class="gi">+        } = *self;</span>
<span class="gi">+</span>
<span class="gi">+        kind.to_stable_hash_key(hcx)</span>
<span class="gi">+    }</span>
<span class="gi">+}</span>
</code></pre></div>



<a name="239664972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239664972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239664972">(May 20 2021 at 21:52)</a>:</h4>
<p>where'd you get that code from?</p>



<a name="239665039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665039">(May 20 2021 at 21:52)</a>:</h4>
<p>well the code does nothing :)</p>



<a name="239665056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665056">(May 20 2021 at 21:52)</a>:</h4>
<p>just delegates to kind's <code>ToStableHashKey</code> impl</p>



<a name="239665069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665069">(May 20 2021 at 21:52)</a>:</h4>
<p>I guess that's a copy of the <code>HashTStable</code> impl more or less</p>



<a name="239665071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665071">(May 20 2021 at 21:52)</a>:</h4>
<p>I was going to implement it for kind</p>



<a name="239665122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665122">(May 20 2021 at 21:53)</a>:</h4>
<p>I see</p>



<a name="239665127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665127">(May 20 2021 at 21:53)</a>:</h4>
<p>This is annoying lol</p>



<a name="239665129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665129">(May 20 2021 at 21:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/239665069">said</a>:</p>
<blockquote>
<p>I guess that's a copy of the <code>HashTStable</code> impl more or less</p>
</blockquote>
<p>but it really does nothing, like I should probably do <code>self.kind.to_stable_hash_key</code></p>



<a name="239665134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665134">(May 20 2021 at 21:53)</a>:</h4>
<p>I'm trying to decide if there is some other way to do it</p>



<a name="239665165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665165">(May 20 2021 at 21:53)</a>:</h4>
<p>so ... <code>HashStable</code> is implemented to <code>Ty</code></p>



<a name="239665170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665170">(May 20 2021 at 21:54)</a>:</h4>
<p>well for <code>TyS</code></p>



<a name="239665184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665184">(May 20 2021 at 21:54)</a>:</h4>
<p>ok so another option would be</p>



<a name="239665215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665215">(May 20 2021 at 21:54)</a>:</h4>
<p>instead of using a hashmap</p>



<a name="239665217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665217">(May 20 2021 at 21:54)</a>:</h4>
<p>what's not is <code>ToStableHashKey</code></p>



<a name="239665220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665220">(May 20 2021 at 21:54)</a>:</h4>
<p>use a vector :)</p>



<a name="239665239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665239">(May 20 2021 at 21:54)</a>:</h4>
<p>honestly it's probably a better data structure anyway</p>



<a name="239665248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665248">(May 20 2021 at 21:54)</a>:</h4>
<p>how many impl Traits are defined on any given function</p>



<a name="239665256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665256">(May 20 2021 at 21:54)</a>:</h4>
<p>typically: 1 :)</p>



<a name="239665265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665265">(May 20 2021 at 21:54)</a>:</h4>
<p>at most "a few"</p>



<a name="239665271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665271">(May 20 2021 at 21:54)</a>:</h4>
<p>using a hashmap is <em>way</em> overkill</p>



<a name="239665328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665328">(May 20 2021 at 21:55)</a>:</h4>
<p>we could use a <code>Vec&lt;(Ty&lt;'tcx&gt;, Data)&gt;</code> and then do a lookup with <code>vec.find(|pair| pair.0 == key)</code></p>



<a name="239665338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665338">(May 20 2021 at 21:55)</a>:</h4>
<p>I was guessing that we were using a <code>HashMap</code> just to easily access by key and see where you hit a duplicate</p>



<a name="239665345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665345">(May 20 2021 at 21:55)</a>:</h4>
<p>right</p>



<a name="239665350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665350">(May 20 2021 at 21:55)</a>:</h4>
<p>so just use a vector for that instead</p>



<a name="239665353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665353">(May 20 2021 at 21:55)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/239665328">said</a>:</p>
<blockquote>
<p>we could use a <code>Vec&lt;(Ty&lt;'tcx&gt;, Data)&gt;</code> and then do a lookup with <code>vec.find(|pair| pair.0 == key)</code></p>
</blockquote>
<p>ahh well :P</p>



<a name="239665362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665362">(May 20 2021 at 21:55)</a>:</h4>
<p>it'll be faster</p>



<a name="239665366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665366">(May 20 2021 at 21:55)</a>:</h4>
<p>I thought that would be bad :P</p>



<a name="239665383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665383">(May 20 2021 at 21:55)</a>:</h4>
<p>but if you say it's not</p>



<a name="239665384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665384">(May 20 2021 at 21:55)</a>:</h4>
<p>I mean to do it nicer, we make a little utility type</p>



<a name="239665387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665387">(May 20 2021 at 21:55)</a>:</h4>
<p>maybe it already exists even</p>



<a name="239665391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665391">(May 20 2021 at 21:56)</a>:</h4>
<p>unsure how much and how critical is where we are doing lookups</p>



<a name="239665430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665430">(May 20 2021 at 21:56)</a>:</h4>
<p>I think it is faster this way</p>



<a name="239665438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665438">(May 20 2021 at 21:56)</a>:</h4>
<p>a hashmap is usually only faster if you have ~100 keys</p>



<a name="239665451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665451">(May 20 2021 at 21:56)</a>:</h4>
<p>I made that up but I read it on some website :)</p>



<a name="239665460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665460">(May 20 2021 at 21:56)</a>:</h4>
<p>lol</p>



<a name="239665462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665462">(May 20 2021 at 21:56)</a>:</h4>
<p>hehe</p>



<a name="239665470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665470">(May 20 2021 at 21:56)</a>:</h4>
<p>but seriously, with a <code>Ty</code> as the key, the <code>==</code> is just a pointer comparison</p>



<a name="239665473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665473">(May 20 2021 at 21:56)</a>:</h4>
<p>yeah, ok, but I see what you meant, we don't really have a lot of values</p>



<a name="239665476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665476">(May 20 2021 at 21:56)</a>:</h4>
<p>the vector lookup will be plenty fast</p>



<a name="239665496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665496">(May 20 2021 at 21:57)</a>:</h4>
<p>maybe make a <code>VecMap&lt;K, V&gt;</code> data structure</p>



<a name="239665500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665500">(May 20 2021 at 21:57)</a>:</h4>
<p>definitely because it doesn't have a lot of elements</p>



<a name="239665524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665524">(May 20 2021 at 21:57)</a>:</h4>
<p>implement <code>HashStable</code> for it so long as <code>K: HashStable</code> and <code>V: HashStable</code></p>



<a name="239665537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665537">(May 20 2021 at 21:57)</a>:</h4>
<p>that'd be the "better factored" way :)</p>



<a name="239665550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665550">(May 20 2021 at 21:57)</a>:</h4>
<p>I see</p>



<a name="239665551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665551">(May 20 2021 at 21:57)</a>:</h4>
<p>the lazy way is to make a trait <code>VecMap</code></p>



<a name="239665556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665556">(May 20 2021 at 21:57)</a>:</h4>
<p>actually that's maybe better</p>



<a name="239665561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665561">(May 20 2021 at 21:57)</a>:</h4>
<p>in rustc_data_structures</p>



<a name="239665607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665607">(May 20 2021 at 21:58)</a>:</h4>
<p>yeah in rustc_data_structures, definitely</p>



<a name="239665620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665620">(May 20 2021 at 21:58)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">trait</span><span class="w"> </span><span class="n">VecMap</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">insert</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">key</span>: <span class="nc">K</span><span class="p">,</span><span class="w"> </span><span class="n">value</span>: <span class="nc">V</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nb">Option</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">get</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">key</span>: <span class="nc">K</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nb">Option</span><span class="o">&lt;&amp;</span><span class="n">V</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">K</span><span class="p">,</span><span class="w"> </span><span class="n">V</span><span class="o">&gt;</span><span class="w"> </span><span class="n">VecMap</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="nb">Vec</span><span class="o">&lt;</span><span class="p">(</span><span class="n">K</span><span class="p">,</span><span class="w"> </span><span class="n">V</span><span class="p">)</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">..</span><span class="p">.</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="239665623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665623">(May 20 2021 at 21:58)</a>:</h4>
<p>and what methods would <code>VecMap</code> have?</p>



<a name="239665627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665627">(May 20 2021 at 21:58)</a>:</h4>
<p>and then you can just import the trait and use those methods</p>



<a name="239665650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665650">(May 20 2021 at 21:58)</a>:</h4>
<p>something like that :)</p>



<a name="239665656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665656">(May 20 2021 at 21:58)</a>:</h4>
<p>yeah insert and get definitely</p>



<a name="239665672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665672">(May 20 2021 at 21:58)</a>:</h4>
<p>that's probably the only methods that get used</p>



<a name="239665684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665684">(May 20 2021 at 21:59)</a>:</h4>
<p>unsure if in order to place it in rustc_data_structure you would want more?</p>



<a name="239665687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665687">(May 20 2021 at 21:59)</a>:</h4>
<p>then you don't have to implement <code>HashStable</code> or anything, should all just work</p>



<a name="239665708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665708">(May 20 2021 at 21:59)</a>:</h4>
<p>you could make a <code>type VecMap&lt;K, V&gt; = Vec&lt;(K, V)&gt;</code> alias if you want :)</p>



<a name="239665709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665709">(May 20 2021 at 21:59)</a>:</h4>
<p>yeah all this makes sense :)</p>



<a name="239665717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665717">(May 20 2021 at 21:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/239665684">said</a>:</p>
<blockquote>
<p>unsure if in order to place it in rustc_data_structure you would want more?</p>
</blockquote>
<p>nah</p>



<a name="239665731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665731">(May 20 2021 at 21:59)</a>:</h4>
<p>I wouldn't add dead code</p>



<a name="239665736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665736">(May 20 2021 at 21:59)</a>:</h4>
<p>what's the point</p>



<a name="239665743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665743">(May 20 2021 at 21:59)</a>:</h4>
<p>people can add more methods as they need them</p>



<a name="239665751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665751">(May 20 2021 at 21:59)</a>:</h4>
<p>ok</p>



<a name="239665763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665763">(May 20 2021 at 22:00)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/239665708">said</a>:</p>
<blockquote>
<p>you could make a <code>type VecMap&lt;K, V&gt; = Vec&lt;(K, V)&gt;</code> alias if you want :)</p>
</blockquote>
<p>so this or better the trait?</p>



<a name="239665830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665830">(May 20 2021 at 22:00)</a>:</h4>
<p>well you need the trait to have the methods</p>



<a name="239665858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665858">(May 20 2021 at 22:00)</a>:</h4>
<p>the only reason to have the type alias</p>



<a name="239665879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665879">(May 20 2021 at 22:00)</a>:</h4>
<p>(in addition to the trait)</p>



<a name="239665912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665912">(May 20 2021 at 22:00)</a>:</h4>
<p>ahh both, so I guess you want different names then :P</p>



<a name="239665931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665931">(May 20 2021 at 22:00)</a>:</h4>
<p>would be so that </p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">pub</span><span class="w"> </span><span class="n">concrete_opaque_types</span>: <span class="nc">FxHashMap</span><span class="o">&lt;</span><span class="n">Ty</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">ty</span>::<span class="n">ResolvedOpaqueTy</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;&gt;</span><span class="p">,</span><span class="w"></span>
</code></pre></div>
<p>becomes</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">pub</span><span class="w"> </span><span class="n">concrete_opaque_types</span>: <span class="nc">VecMap</span><span class="o">&lt;</span><span class="n">Ty</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">ty</span>::<span class="n">ResolvedOpaqueTy</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;&gt;</span><span class="p">,</span><span class="w"></span>
</code></pre></div>



<a name="239665936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665936">(May 20 2021 at 22:00)</a>:</h4>
<p>unsure if I have followed what you intended to do</p>



<a name="239665950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665950">(May 20 2021 at 22:01)</a>:</h4>
<p>ah yes, you'd need to cal the trait <code>VecMapExt</code> or something</p>



<a name="239665961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665961">(May 20 2021 at 22:01)</a>:</h4>
<p>ok</p>



<a name="239665988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665988">(May 20 2021 at 22:01)</a>:</h4>
<p>vs</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">pub</span><span class="w"> </span><span class="n">concrete_opaque_types</span>: <span class="nb">Vec</span><span class="o">&lt;</span><span class="p">(</span><span class="n">Ty</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">ty</span>::<span class="n">ResolvedOpaqueTy</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="p">)</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
</code></pre></div>



<a name="239665999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239665999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239665999">(May 20 2021 at 22:01)</a>:</h4>
<p>the <code>VecMap</code> seems a bit easier to read?</p>



<a name="239666008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239666008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239666008">(May 20 2021 at 22:01)</a>:</h4>
<p>right</p>



<a name="239666014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/239666014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#239666014">(May 20 2021 at 22:01)</a>:</h4>
<p>makes sense</p>



<a name="240210482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240210482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240210482">(May 25 2021 at 16:01)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> <span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="240211938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240211938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240211938">(May 25 2021 at 16:11)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="240211955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240211955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240211955">(May 25 2021 at 16:11)</a>:</h4>
<p>didn't touch the code again since last we've talked</p>



<a name="240212015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240212015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240212015">(May 25 2021 at 16:12)</a>:</h4>
<p>will try to finish it today</p>



<a name="240214239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240214239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240214239">(May 25 2021 at 16:28)</a>:</h4>
<p>ok</p>



<a name="240465988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240465988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240465988">(May 27 2021 at 13:22)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> <span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="240465990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240465990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240465990">(May 27 2021 at 13:23)</a>:</h4>
<p>just checking :)</p>



<a name="240469101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240469101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240469101">(May 27 2021 at 13:43)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> zero progress, had zero time for this</p>



<a name="240469172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240469172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240469172">(May 27 2021 at 13:44)</a>:</h4>
<p>today unless something happens, I'm going to work on it</p>



<a name="240611223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240611223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240611223">(May 28 2021 at 14:25)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> I'm arond now btw</p>



<a name="240612598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240612598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240612598">(May 28 2021 at 14:35)</a>:</h4>
<p>I'm going to leave some notes for when you get a chance</p>



<a name="240615685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240615685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240615685">(May 28 2021 at 14:56)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="240615700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240615700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240615700">(May 28 2021 at 14:56)</a>:</h4>
<p>I'm around</p>



<a name="240615824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240615824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240615824">(May 28 2021 at 14:58)</a>:</h4>
<p>wave</p>



<a name="240615910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240615910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240615910">(May 28 2021 at 14:58)</a>:</h4>
<p>I have a meeting coming up but I can probably chat on the side, since I'm not likely to be an active participant</p>



<a name="240615934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240615934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240615934">(May 28 2021 at 14:58)</a>:</h4>
<p>I got delayed by some local setup issues</p>



<a name="240616009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240616009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240616009">(May 28 2021 at 14:59)</a>:</h4>
<p>oh, wait, <em>that</em> meeting is later</p>



<a name="240616036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240616036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240616036">(May 28 2021 at 14:59)</a>:</h4>
<p>full calendar today :(</p>



<a name="240617730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240617730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240617730">(May 28 2021 at 15:10)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> no worries</p>



<a name="240617830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240617830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240617830">(May 28 2021 at 15:11)</a>:</h4>
<p>I'm going to work a bit on this issue today, if you can throw me a headline would be great, anyway I have other issues that I need to work on so no worries :)</p>



<a name="240622397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240622397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240622397">(May 28 2021 at 15:42)</a>:</h4>
<p>OK, I'm around for a bit now</p>



<a name="240622402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240622402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240622402">(May 28 2021 at 15:42)</a>:</h4>
<p>in a meeting but inactive</p>



<a name="240622422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240622422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240622422">(May 28 2021 at 15:42)</a>:</h4>
<p>let me try to dump some thoughts <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span></p>



<a name="240625317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240625317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240625317">(May 28 2021 at 16:04)</a>:</h4>
<p>ok, I got distracted again, but here we go</p>



<a name="240625336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240625336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240625336">(May 28 2021 at 16:04)</a>:</h4>
<p>so <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> we've been talking about how the compiler infers the value for a named impl trait</p>



<a name="240625559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240625559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240625559">(May 28 2021 at 16:06)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/16143d10679537d3fde4247e15334e78ad9d55b9/compiler/rustc_mir/src/borrow_check/region_infer/opaque_types.rs#L11-L49">this is the code that does the hard work</a></p>



<a name="240625630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240625630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240625630">(May 28 2021 at 16:06)</a>:</h4>
<p>it produces, for  given function, a map saying "for this opaque type, we have inferred this value"</p>



<a name="240625743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240625743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240625743">(May 28 2021 at 16:07)</a>:</h4>
<p>that map is (on master) keyed by <code>DefId</code> but on your branch I think should be keyed by a <code>Ty</code></p>



<a name="240625764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240625764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240625764">(May 28 2021 at 16:07)</a>:</h4>
<p>this is (however) not entirely obvious</p>



<a name="240625847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240625847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240625847">(May 28 2021 at 16:07)</a>:</h4>
<p>maybe it should be keyed by <code>DefId</code> still actually</p>



<a name="240632556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240632556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240632556">(May 28 2021 at 17:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yeah, my plan yesterday was to keep that in the way it was, keyed by <code>DefId</code> and convert that to <code>Ty</code> when/if I need the results of that somehow</p>



<a name="240635992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240635992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240635992">(May 28 2021 at 17:29)</a>:</h4>
<p>OK, I'm around now <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> if you are</p>



<a name="240636585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240636585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240636585">(May 28 2021 at 17:33)</a>:</h4>
<p>so let me take some notes</p>



<a name="240636596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240636596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240636596">(May 28 2021 at 17:33)</a>:</h4>
<p>here is how it works "overall"</p>



<a name="240636603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240636603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240636603">(May 28 2021 at 17:33)</a>:</h4>
<p>you have a <code>type Foo&lt;T&gt; = impl Trait</code></p>



<a name="240636680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240636680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240636680">(May 28 2021 at 17:34)</a>:</h4>
<p>and then you have various "defining uses" of <code>Foo</code>-- there are the uses from which we will infer the type for <code>Foo</code></p>



<a name="240636700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240636700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240636700">(May 28 2021 at 17:34)</a>:</h4>
<p>in our case, these are typically functions that return <code>Foo</code> and are located within the same module where <code>Foo</code> was declared</p>



<a name="240636705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240636705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240636705">(May 28 2021 at 17:34)</a>:</h4>
<p>so e.g.</p>



<a name="240636783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240636783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240636783">(May 28 2021 at 17:35)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">type</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="n">Debug</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">a</span><span class="o">&lt;</span><span class="n">A</span>: <span class="nc">Debug</span><span class="o">&gt;</span><span class="p">(</span><span class="n">a</span>: <span class="nc">A</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">A</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="fm">vec!</span><span class="p">[</span><span class="n">a</span><span class="p">]</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">b</span><span class="o">&lt;</span><span class="n">B</span>: <span class="nc">Debug</span><span class="o">&gt;</span><span class="p">(</span><span class="n">b</span>: <span class="nc">B</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">B</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="fm">vec!</span><span class="p">[</span><span class="n">b</span><span class="p">]</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="240636807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240636807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240636807">(May 28 2021 at 17:35)</a>:</h4>
<p>in that example, there are two "defining uses" of <code>Foo</code> -- one in the return type of <code>a</code>, and one in the return type of <code>b</code></p>



<a name="240636939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240636939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240636939">(May 28 2021 at 17:36)</a>:</h4>
<p>when we type-check a function, we find each <em>defining use</em> of an <code>impl Trait</code> that appears in its signature and we replace that with an inference variable</p>



<a name="240636954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240636954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240636954">(May 28 2021 at 17:36)</a>:</h4>
<p>this is the code you are tweaking now: currently we index only on the <code>DefId</code>, and we've seen that this is too limited</p>



<a name="240637076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240637076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240637076">(May 28 2021 at 17:37)</a>:</h4>
<p>I can't seem to find that code anymore</p>



<a name="240637199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240637199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240637199">(May 28 2021 at 17:38)</a>:</h4>
<p>I guess it's <a href="https://github.com/rust-lang/rust/blob/16143d10679537d3fde4247e15334e78ad9d55b9/compiler/rustc_trait_selection/src/opaque_types.rs#L161-L193">this code</a></p>



<a name="240637297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240637297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240637297">(May 28 2021 at 17:39)</a>:</h4>
<p>anyway, let's hold off on that</p>



<a name="240637321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240637321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240637321">(May 28 2021 at 17:39)</a>:</h4>
<p>once we've run type-check, we can look at the value we selected for those inference variables</p>



<a name="240637344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240637344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240637344">(May 28 2021 at 17:40)</a>:</h4>
<p>and we can use that to infer the value of <code>Foo</code></p>



<a name="240637496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240637496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240637496">(May 28 2021 at 17:40)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/16143d10679537d3fde4247e15334e78ad9d55b9/compiler/rustc_mir/src/borrow_check/region_infer/opaque_types.rs#L50-L56">that is happening here</a> -- we currently do this from during borrow check, because that value may involve lifetimes</p>



<a name="240637703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240637703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240637703">(May 28 2021 at 17:42)</a>:</h4>
<p>now, the key thing is that we do this for <em>both</em> <code>a</code> and <code>b</code></p>



<a name="240637713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240637713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240637713">(May 28 2021 at 17:42)</a>:</h4>
<p>so we wind up with two values for <code>Foo</code></p>



<a name="240637729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240637729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240637729">(May 28 2021 at 17:43)</a>:</h4>
<p>one per defining use, essentially</p>



<a name="240637768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240637768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240637768">(May 28 2021 at 17:43)</a>:</h4>
<p>in this example, both of them will be <code>Vec&lt;T&gt;</code></p>



<a name="240637782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240637782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240637782">(May 28 2021 at 17:43)</a>:</h4>
<p>that's good-- we want all the values we infer to be the same</p>



<a name="240638042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240638042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240638042">(May 28 2021 at 17:45)</a>:</h4>
<p>now, there is a query that asks "what is the value of <code>Foo</code>"</p>



<a name="240638371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240638371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240638371">(May 28 2021 at 17:48)</a>:</h4>
<p>I think that is done in the <code>type_of</code> query, maybe</p>



<a name="240638443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240638443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240638443">(May 28 2021 at 17:48)</a>:</h4>
<p>ah some of this is documented in <a href="https://rustc-dev-guide.rust-lang.org/opaque-types-type-alias-impl-trait.html">https://rustc-dev-guide.rust-lang.org/opaque-types-type-alias-impl-trait.html</a></p>



<a name="240638460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240638460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240638460">(May 28 2021 at 17:49)</a>:</h4>
<p>but not very thoroughly</p>



<a name="240638545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240638545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240638545">(May 28 2021 at 17:49)</a>:</h4>
<p>ok, <a href="https://github.com/rust-lang/rust/blob/16143d10679537d3fde4247e15334e78ad9d55b9/compiler/rustc_typeck/src/collect/type_of.rs#L464-L465">here is the function</a></p>



<a name="240638557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240638557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240638557">(May 28 2021 at 17:49)</a>:</h4>
<p>it should really be in its own file I think</p>



<a name="240638955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240638955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240638955">(May 28 2021 at 17:52)</a>:</h4>
<p>anyway so what that does</p>



<a name="240639285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240639285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240639285">(May 28 2021 at 17:55)</a>:</h4>
<p>for a given impl trait (like <code>Foo</code>), it <a href="https://github.com/rust-lang/rust/blob/16143d10679537d3fde4247e15334e78ad9d55b9/compiler/rustc_typeck/src/collect/type_of.rs#L617-L641">visits  the hir, looking for items defining uses</a></p>



<a name="240639370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240639370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240639370">(May 28 2021 at 17:56)</a>:</h4>
<p>for each one, it invokes <a href="https://github.com/rust-lang/rust/blob/16143d10679537d3fde4247e15334e78ad9d55b9/compiler/rustc_typeck/src/collect/type_of.rs#L477-L478"><code>ConstraintLocator::check</code></a></p>



<a name="240639456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240639456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240639456">(May 28 2021 at 17:56)</a>:</h4>
<p>that function will invoke borrow check to <a href="https://github.com/rust-lang/rust/blob/16143d10679537d3fde4247e15334e78ad9d55b9/compiler/rustc_typeck/src/collect/type_of.rs#L496-L497">get the concrete opaque types inferred for <code>Foo</code> by that function</a> (if any)</p>



<a name="240639517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240639517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240639517">(May 28 2021 at 17:57)</a>:</h4>
<p>we then combine this with the value inferred from other functions we visited on our walk, <a href="https://github.com/rust-lang/rust/blob/16143d10679537d3fde4247e15334e78ad9d55b9/compiler/rustc_typeck/src/collect/type_of.rs#L549-L562">reporting an error if they are different</a></p>



<a name="240639569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240639569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240639569">(May 28 2021 at 17:58)</a>:</h4>
<p><em>ok</em>, now that I've refreshed my memory of the code, here is what I think you should do:</p>



<a name="240639637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240639637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240639637">(May 28 2021 at 17:58)</a>:</h4>
<ul>
<li>extract a helper function for the <a href="https://github.com/rust-lang/rust/blob/16143d10679537d3fde4247e15334e78ad9d55b9/compiler/rustc_typeck/src/collect/type_of.rs#L548-L571">logic that combines multiple the values from multiple functions</a>, let's call it <code>merge_opaque_type_definition</code></li>
</ul>



<a name="240639838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240639838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240639838">(May 28 2021 at 18:00)</a>:</h4>
<ul>
<li>in the borrow check, when we instantiate all the defining uses, we use a <code>VecMap&lt;Ty&lt;'tcx&gt;, ...&gt;</code> for those, since we will need one inference variable per defining use. That means we have to change <a href="https://github.com/rust-lang/rust/blob/16143d10679537d3fde4247e15334e78ad9d55b9/compiler/rustc_trait_selection/src/opaque_types.rs#L19-L20"><code>OpaqueTypeMap</code></a> to use <code>VecMap&lt;Ty&lt;'tcx&gt;...</code> instead.</li>
</ul>



<a name="240639944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240639944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240639944">(May 28 2021 at 18:01)</a>:</h4>
<p><strong>However</strong></p>



<a name="240639994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240639994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240639994">(May 28 2021 at 18:01)</a>:</h4>
<p>I would NOT change <code>concrete_opaque_types</code> in either the type check or borrow check results</p>



<a name="240640002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640002">(May 28 2021 at 18:01)</a>:</h4>
<p>those can still be keyed by <code>DefId</code></p>



<a name="240640023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640023">(May 28 2021 at 18:02)</a>:</h4>
<p>Why? Those maps contain the <em>result of inference for a particular function</em></p>



<a name="240640090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640090">(May 28 2021 at 18:02)</a>:</h4>
<p>while there may be mutiple uses of <code>Foo</code> within a particular function, they should all infer to the same <code>ResolvedOpaqueTy</code></p>



<a name="240640113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640113">(May 28 2021 at 18:02)</a>:</h4>
<p>(hmm)</p>



<a name="240640122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640122">(May 28 2021 at 18:02)</a>:</h4>
<p>I'm double checking if what I'm saying makes sense :)</p>



<a name="240640494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640494">(May 28 2021 at 18:05)</a>:</h4>
<p>Well, I think my logic makes sense <em>but</em> the data structure would need more changs</p>



<a name="240640530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640530">(May 28 2021 at 18:06)</a>:</h4>
<p>so the other option is yes we should generalize it</p>



<a name="240640562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640562">(May 28 2021 at 18:06)</a>:</h4>
<p>in which case we don't need that helper function</p>



<a name="240640616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640616">(May 28 2021 at 18:06)</a>:</h4>
<p>but we would want to modify the visitor so that it is prepared to visit multiple def-ids per function item</p>



<a name="240640681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640681">(May 28 2021 at 18:07)</a>:</h4>
<p><em>oh</em> so <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span></p>



<a name="240640705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640705">(May 28 2021 at 18:07)</a>:</h4>
<p>this <a href="https://github.com/rust-lang/rust/blob/16143d10679537d3fde4247e15334e78ad9d55b9/compiler/rustc_middle/src/ty/context.rs#L288-L298"><code>ResolvedOpaqueTy</code></a> type</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="sd">/// All information necessary to validate and reveal an `impl Trait`.</span>
<span class="cp">#[derive(TyEncodable, TyDecodable, Debug, HashStable)]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">ResolvedOpaqueTy</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// The revealed type as seen by this function.</span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="n">concrete_type</span>: <span class="nc">Ty</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// Generic parameters on the opaque type as passed by this function.</span>
<span class="w">    </span><span class="sd">/// For `type Foo&lt;A, B&gt; = impl Bar&lt;A, B&gt;; fn foo&lt;T, U&gt;() -&gt; Foo&lt;T, U&gt; { .. }`</span>
<span class="w">    </span><span class="sd">/// this is `[T, U]`, not `[A, B]`.</span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="n">substs</span>: <span class="nc">SubstsRef</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="240640710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640710">(May 28 2021 at 18:07)</a>:</h4>
<p>it probably just goes away</p>



<a name="240640719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640719">(May 28 2021 at 18:07)</a>:</h4>
<p>the <code>substs: SubstRef</code> field will become part of the key in the <code>VecMap</code></p>



<a name="240640760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640760">(May 28 2021 at 18:08)</a>:</h4>
<p>and the value will be the <code>concrete_type</code> field</p>



<a name="240640785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240640785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240640785">(May 28 2021 at 18:08)</a>:</h4>
<p>ok, I think that's the right path, or at least the path of least resistance</p>



<a name="240642422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240642422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240642422">(May 28 2021 at 18:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span>, yeah, I've figured that a couple of <code>substs</code> around could go away given that this is now part of the key</p>



<a name="240642528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240642528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240642528">(May 28 2021 at 18:22)</a>:</h4>
<p>gave a glance at your thoughts and makes sense, may need to check a bit better what you're saying and contrast with the code to make myself a better idea</p>



<a name="240642542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240642542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240642542">(May 28 2021 at 18:22)</a>:</h4>
<p>but seems good <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="240642785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240642785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240642785">(May 28 2021 at 18:24)</a>:</h4>
<p>not sure about a couple of things on your conclusions, one recurring problem I have is that my english level disallow me to condense things when there are back and forths <span aria-label="joy" class="emoji emoji-1f602" role="img" title="joy">:joy:</span></p>



<a name="240642815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240642815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240642815">(May 28 2021 at 18:24)</a>:</h4>
<p>anyway a couple of concrete questions</p>



<a name="240642876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240642876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240642876">(May 28 2021 at 18:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/240639637">said</a>:</p>
<blockquote>
<ul>
<li>extract a helper function for the <a href="https://github.com/rust-lang/rust/blob/16143d10679537d3fde4247e15334e78ad9d55b9/compiler/rustc_typeck/src/collect/type_of.rs#L548-L571">logic that combines multiple the values from multiple functions</a>, let's call it <code>merge_opaque_type_definition</code></li>
</ul>
</blockquote>
<p>what would be the purpose of extracting this function? I guess you're seeing something that I'm not right now, may realized meanwhile coding</p>



<a name="240642926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240642926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240642926">(May 28 2021 at 18:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/240639994">said</a>:</p>
<blockquote>
<p>I would NOT change <code>concrete_opaque_types</code> in either the type check or borrow check results</p>
</blockquote>
<p>about this <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span>, it was more or less what I was thinking</p>



<a name="240642947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240642947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240642947">(May 28 2021 at 18:25)</a>:</h4>
<p>although with your explanation now makes much more sense :)</p>



<a name="240643030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240643030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240643030">(May 28 2021 at 18:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/240640562">said</a>:</p>
<blockquote>
<p>in which case we don't need that helper function</p>
</blockquote>
<p>I guess you're saying that we don't need that</p>



<a name="240643079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240643079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240643079">(May 28 2021 at 18:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/240640616">said</a>:</p>
<blockquote>
<p>but we would want to modify the visitor so that it is prepared to visit multiple def-ids per function item</p>
</blockquote>
<p>unsure I got this in particular, why multiple def-ids?</p>



<a name="240643177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240643177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240643177">(May 28 2021 at 18:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/240640760">said</a>:</p>
<blockquote>
<p>and the value will be the <code>concrete_type</code> field</p>
</blockquote>
<p>the change you're proposing makes sense, I've figured a couple of cases where this happens too as i've mentioned above</p>



<a name="240652152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652152">(May 28 2021 at 19:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/240642876">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/240639637">said</a>:<br>
what would be the purpose of extracting this function? I guess you're seeing something that I'm not right now, may realized meanwhile coding</p>
</blockquote>
<p>so I thnk I convinced myself that we should not have it by the end</p>



<a name="240652197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652197">(May 28 2021 at 19:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/240642926">said</a>:</p>
<blockquote>
<blockquote>
<p>I would NOT change <code>concrete_opaque_types</code> in either the type check or borrow check results</p>
</blockquote>
<p>about this <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span>, it was more or less what I was thinking</p>
</blockquote>
<p>so--- I kind of reserved this by the end, because it seemed like it would actually be easier to update those maps (even though it involves changing a bunch of random bits of code)</p>



<a name="240652271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652271">(May 28 2021 at 19:48)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/240643079">said</a>:</p>
<blockquote>
<blockquote>
<p>but we would want to modify the visitor so that it is prepared to visit multiple def-ids per function item</p>
</blockquote>
<p>unsure I got this in particular, why multiple def-ids?</p>
</blockquote>
<p>this was a mistake. What I meant is "multiple definitions for the given Opaque Type"</p>



<a name="240652284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652284">(May 28 2021 at 19:48)</a>:</h4>
<p>so right now the opaque type has a def-id <code>D</code></p>



<a name="240652345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652345">(May 28 2021 at 19:49)</a>:</h4>
<p>and we do something like</p>



<a name="240652431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652431">(May 28 2021 at 19:49)</a>:</h4>
<div class="codehilite"><pre><span></span><code>let mut final_result = None;
for each function F {
    if let Some((v1, substs))) = definition of D from F {
        let v = infer_definition(v1, substs);
        let previous_result = final_result.replace(v);
        if let Some(old_v) = previous_result {
            if old_v != v { error }
       }
    }
}
</code></pre></div>



<a name="240652531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652531">(May 28 2021 at 19:50)</a>:</h4>
<p>but if we make the change I am proposing, then this doesn't work, because the key to map is not just a def-id but the (def-id, substs)</p>



<a name="240652582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652582">(May 28 2021 at 19:50)</a>:</h4>
<p>(actually, <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span>, if we are using a <code>VecMap</code>, you don't want the key to be a <code>Ty&lt;'tcx&gt;</code>, but just the <code>(DefId, SubstsRef,'tcx&gt;)</code> pair, I think)</p>



<a name="240652597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652597">(May 28 2021 at 19:50)</a>:</h4>
<p>maybe a newtype'd one</p>



<a name="240652626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652626">(May 28 2021 at 19:51)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">OpaqueTypeRef</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="p">(</span><span class="k">pub</span><span class="w"> </span><span class="n">DefId</span><span class="p">,</span><span class="w"> </span><span class="k">pub</span><span class="w"> </span><span class="n">SubstsRef</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="p">)</span><span class="w"></span>
</code></pre></div>



<a name="240652635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652635">(May 28 2021 at 19:51)</a>:</h4>
<p>anyway so</p>



<a name="240652639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652639">(May 28 2021 at 19:51)</a>:</h4>
<p>the code becomes</p>



<a name="240652681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652681">(May 28 2021 at 19:51)</a>:</h4>
<p>makes sense</p>



<a name="240652685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652685">(May 28 2021 at 19:51)</a>:</h4>
<div class="codehilite"><pre><span></span><code>let mut final_result = None;
for each function F {
    for ((d1, s1), v1) in defitions from F {
        if D != d1 { continue; }
        let v = infer_definition_from(v1, s1);
        let previous_result = final_result.replace(v);
        if let Some(old_v) = previous_result {
            if old_v != v { error }
       }
    }
}
</code></pre></div>



<a name="240652777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652777">(May 28 2021 at 19:52)</a>:</h4>
<p>ok, I updated the pseudo-code, I was missing one important detail</p>



<a name="240652891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652891">(May 28 2021 at 19:53)</a>:</h4>
<p>but the key point is, if you change that from a <code>FxHashMap&lt;DefId, (Substs, Ty)&gt;</code> (as today) to a <code>VecMap&lt;(DefId, Substs), Ty&gt;</code></p>



<a name="240652914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652914">(May 28 2021 at 19:53)</a>:</h4>
<p>you may have multiple entries for the same <code>DefId</code></p>



<a name="240652926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652926">(May 28 2021 at 19:53)</a>:</h4>
<p>but that's ok because the code is already setup</p>



<a name="240652935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652935">(May 28 2021 at 19:53)</a>:</h4>
<p>right</p>



<a name="240652938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652938">(May 28 2021 at 19:53)</a>:</h4>
<p>to iterate over multiple <em>functions</em></p>



<a name="240652947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652947">(May 28 2021 at 19:53)</a>:</h4>
<p>so now you have just N per function, kind of a flat map</p>



<a name="240652950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240652950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240652950">(May 28 2021 at 19:53)</a>:</h4>
<p>instead of 1 per function</p>



<a name="240653009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653009">(May 28 2021 at 19:54)</a>:</h4>
<p>the alternative -- what I was gong to <em>orgiinally</em> suggest --</p>



<a name="240653016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653016">(May 28 2021 at 19:54)</a>:</h4>
<p>was that for a particular function you would already collapse it down to one value</p>



<a name="240653022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653022">(May 28 2021 at 19:54)</a>:</h4>
<p>and then you would again collapse across functions</p>



<a name="240653027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653027">(May 28 2021 at 19:54)</a>:</h4>
<p>but I think that will be messier</p>



<a name="240653046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653046">(May 28 2021 at 19:54)</a>:</h4>
<p>you might wind up tweaking what I wrote above so that you <em>first</em> collapse within the function and then check against the other functions, just to give better error mesages,</p>



<a name="240653050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653050">(May 28 2021 at 19:54)</a>:</h4>
<p>but I woudl still do it all in that final phase</p>



<a name="240653067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653067">(May 28 2021 at 19:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/240653016">said</a>:</p>
<blockquote>
<p>was that for a particular function you would already collapse it down to one value</p>
</blockquote>
<p>unsure what you meant here</p>



<a name="240653087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653087">(May 28 2021 at 19:55)</a>:</h4>
<p>consider the motivating example we started with</p>



<a name="240653091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653091">(May 28 2021 at 19:55)</a>:</h4>
<p>what do you mean by collapse it down to one value?</p>



<a name="240653116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653116">(May 28 2021 at 19:55)</a>:</h4>
<div class="codehilite" data-code-language="rusttype"><pre><span></span><code>fn a&lt;A: Debug&gt;(a: A) -&gt; Foo&lt;A&gt; {
    vec![a]
}

fn b&lt;B: Debug&gt;(b: B) -&gt; Foo&lt;B&gt; {
    vec![b]
}
</code></pre></div>



<a name="240653127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653127">(May 28 2021 at 19:55)</a>:</h4>
<p>well actually</p>



<a name="240653137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653137">(May 28 2021 at 19:55)</a>:</h4>
<p>so in taht example we have two definitions of <code>Foo</code></p>



<a name="240653148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653148">(May 28 2021 at 19:55)</a>:</h4>
<p>from two different functions</p>



<a name="240653153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653153">(May 28 2021 at 19:55)</a>:</h4>
<p>but the motivating example for THIS bug is more like</p>



<a name="240653280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653280">(May 28 2021 at 19:56)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">type</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Debug</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">f1</span><span class="o">&lt;</span><span class="n">A</span>: <span class="nc">Debug</span><span class="p">,</span><span class="w"> </span><span class="n">B</span>: <span class="nc">Debug</span><span class="o">&gt;</span><span class="p">(</span><span class="n">a</span>: <span class="nc">A</span><span class="p">,</span><span class="w"> </span><span class="n">b</span>: <span class="nc">B</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="p">(</span><span class="n">Foo</span><span class="o">&lt;</span><span class="n">A</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="n">B</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">(</span><span class="fm">vec!</span><span class="p">[</span><span class="n">a</span><span class="p">],</span><span class="w"> </span><span class="fm">vec!</span><span class="p">[</span><span class="n">b</span><span class="p">])</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">f2</span><span class="o">&lt;</span><span class="n">A</span>: <span class="nc">Debug</span><span class="p">,</span><span class="w"> </span><span class="n">B</span>: <span class="nc">Debug</span><span class="o">&gt;</span><span class="p">(</span><span class="n">a</span>: <span class="nc">A</span><span class="p">,</span><span class="w"> </span><span class="n">b</span>: <span class="nc">B</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="p">(</span><span class="n">Foo</span><span class="o">&lt;</span><span class="n">A</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="n">B</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">(</span><span class="fm">vec!</span><span class="p">[</span><span class="n">a</span><span class="p">],</span><span class="w"> </span><span class="fm">vec!</span><span class="p">[</span><span class="n">b</span><span class="p">])</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="240653308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653308">(May 28 2021 at 19:56)</a>:</h4>
<p>and the key point here is that we have <strong>four definitions</strong> of <code>Foo</code> (all of which work out to the same type, <code>Vec&lt;T&gt;</code>)</p>



<a name="240653318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653318">(May 28 2021 at 19:56)</a>:</h4>
<p>two from each function</p>



<a name="240653355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653355">(May 28 2021 at 19:57)</a>:</h4>
<p>so what I am proposing is that when we type-check <code>f1</code> and <code>f2</code></p>



<a name="240653371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653371">(May 28 2021 at 19:57)</a>:</h4>
<p>we will produce a <code>VecMap</code> for each of them with two entries</p>



<a name="240653375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653375">(May 28 2021 at 19:57)</a>:</h4>
<p>e.g.,</p>



<a name="240653417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653417">(May 28 2021 at 19:57)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="fm">vec!</span><span class="p">[</span><span class="w"></span>
<span class="w">    </span><span class="p">((</span><span class="n">Foo</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="n">A</span><span class="p">]),</span><span class="w"> </span><span class="nb">Vec</span><span class="o">&lt;</span><span class="n">A</span><span class="o">&gt;</span><span class="p">),</span><span class="w"></span>
<span class="w">    </span><span class="p">((</span><span class="n">Foo</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="n">B</span><span class="p">]),</span><span class="w"> </span><span class="nb">Vec</span><span class="o">&lt;</span><span class="n">B</span><span class="o">&gt;</span><span class="p">),</span><span class="w"></span>
<span class="p">]</span><span class="w"></span>
</code></pre></div>



<a name="240653443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653443">(May 28 2021 at 19:58)</a>:</h4>
<p>with me so far?</p>



<a name="240653488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653488">(May 28 2021 at 19:58)</a>:</h4>
<p>here <code>Foo</code> means "def-id of <code>Foo</code>"</p>



<a name="240653525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653525">(May 28 2021 at 19:58)</a>:</h4>
<p>and <code>A</code> and <code>Vec&lt;A&gt;</code> means "<code>Ty&lt;'tcx&gt;</code> representing the type <code>A</code> and <code>Vec&lt;A&gt;</code>"</p>



<a name="240653612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653612">(May 28 2021 at 19:59)</a>:</h4>
<p>then in the final phase, we are going to walk those vec-maps, and so we will walk all four definiing uses, and we will infer that the type of <code>Foo</code> in each case is <code>Vec&lt;T&gt;</code></p>



<a name="240653627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240653627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240653627">(May 28 2021 at 19:59)</a>:</h4>
<p>since all those 4 uses infer to the same final type, we are happy</p>



<a name="240654390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240654390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240654390">(May 28 2021 at 20:05)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="240654504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240654504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240654504">(May 28 2021 at 20:06)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> still if I got what you meant correctly you prefer me to not take this last approach and follow the previous one?</p>



<a name="240654586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240654586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240654586">(May 28 2021 at 20:07)</a>:</h4>
<p>I'd need to re-read this conversation again and check the code in order to better understand all this that's going on</p>



<a name="240675669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240675669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240675669">(May 29 2021 at 01:11)</a>:</h4>
<p>I'm not sure which is "the last" or "previous" etc <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> :)</p>



<a name="240675670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240675670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240675670">(May 29 2021 at 01:11)</a>:</h4>
<p>but I did change my mind mid explanation</p>



<a name="240675672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240675672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240675672">(May 29 2021 at 01:11)</a>:</h4>
<p>I think that you want to change basically all the maps related here to <code>VecMap</code></p>



<a name="240675811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240675811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240675811">(May 29 2021 at 01:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/240653009">said</a>:</p>
<blockquote>
<p>the alternative -- what I was gong to <em>orgiinally</em> suggest --</p>
</blockquote>
<p>I was referring as "previous" to what you've said before this point and the last to what you've said after this point</p>



<a name="240675818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240675818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240675818">(May 29 2021 at 01:15)</a>:</h4>
<p>it seemed to me for some reason when I first read that, that you wanted me to take the "previous" approach</p>



<a name="240675860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/240675860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#240675860">(May 29 2021 at 01:16)</a>:</h4>
<p>unsure, anyway I need to re-read everything and condense the info</p>



<a name="241068133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241068133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241068133">(Jun 01 2021 at 20:06)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> were you able to make sense of what I wrote in the end? :)</p>



<a name="241068910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241068910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241068910">(Jun 01 2021 at 20:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I was reading again from the beginning but I'm not sure I got what alternative you wanted me to follow</p>



<a name="241069062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241069062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241069062">(Jun 01 2021 at 20:14)</a>:</h4>
<p>going to start writing some stuff here <a href="https://hackmd.io/4eIknVE7TaWAuiPpu_-gpA">https://hackmd.io/4eIknVE7TaWAuiPpu_-gpA</a></p>



<a name="241071263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241071263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241071263">(Jun 01 2021 at 20:32)</a>:</h4>
<p>ok, let me try to help with that</p>



<a name="241072764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241072764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241072764">(Jun 01 2021 at 20:44)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> still here?</p>



<a name="241073976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241073976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241073976">(Jun 01 2021 at 20:53)</a>:</h4>
<p>yes</p>



<a name="241074520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241074520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241074520">(Jun 01 2021 at 20:57)</a>:</h4>
<p>ok so</p>



<a name="241074528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241074528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241074528">(Jun 01 2021 at 20:57)</a>:</h4>
<p>at the bottom of your hackmd</p>



<a name="241074536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241074536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241074536">(Jun 01 2021 at 20:57)</a>:</h4>
<p>I added what I see as the steps needed</p>



<a name="241075000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241075000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241075000">(Jun 01 2021 at 21:01)</a>:</h4>
<p>does what I wrote make any sense?</p>



<a name="241075219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241075219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241075219">(Jun 01 2021 at 21:02)</a>:</h4>
<p>reading ...</p>



<a name="241075405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241075405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241075405">(Jun 01 2021 at 21:04)</a>:</h4>
<p>yes makes sense</p>



<a name="241075428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241075428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241075428">(Jun 01 2021 at 21:04)</a>:</h4>
<p>I also put some idea of what to order</p>



<a name="241533752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241533752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241533752">(Jun 04 2021 at 13:23)</a>:</h4>
<p>don't think I forgot <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span></p>



<a name="241533762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241533762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241533762">(Jun 04 2021 at 13:23)</a>:</h4>
<p>muaaahahahahahaha</p>



<a name="241533781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241533781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241533781">(Jun 04 2021 at 13:23)</a>:</h4>
<div class="message_inline_image"><a href="https://media0.giphy.com/media/FYnYcQoFmlPeU/giphy.gif?cid=c623cb3501xmcvlqjxut8wyvrqxbimy8w9095hw06g11n58p&amp;rid=giphy.gif&amp;ct=g"><img src="https://uploads.zulipusercontent.net/4aefa695541c93d60f2e78d2adf112ce22c23df2/68747470733a2f2f6d65646961302e67697068792e636f6d2f6d656469612f46596e5963516f466d6c5065552f67697068792e6769663f6369643d63363233636233353031786d63766c716a7875743877797672717862696d79387739303935687730366731316e353870267269643d67697068792e6769662663743d67"></a></div>



<a name="241535099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241535099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241535099">(Jun 04 2021 at 13:33)</a>:</h4>
<p>hahahaha</p>



<a name="241535115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241535115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241535115">(Jun 04 2021 at 13:33)</a>:</h4>
<p>yeah, again, sorry for putting this task to sleep</p>



<a name="241535176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241535176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241535176">(Jun 04 2021 at 13:33)</a>:</h4>
<p>oh, I should review your hackmd</p>



<a name="241535223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241535223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241535223">(Jun 04 2021 at 13:34)</a>:</h4>
<p>or, your changes to the hackmd</p>



<a name="241535296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241535296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241535296">(Jun 04 2021 at 13:34)</a>:</h4>
<p>well if you want check that out, but the purpose now of the hackmd is more like a blog post than something that is right now gonna help me code</p>



<a name="241535318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241535318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241535318">(Jun 04 2021 at 13:34)</a>:</h4>
<p>but still kind of reflects my understanding of what's going on</p>



<a name="241535400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241535400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241535400">(Jun 04 2021 at 13:35)</a>:</h4>
<p>I'm reading it now</p>



<a name="241535412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241535412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241535412">(Jun 04 2021 at 13:35)</a>:</h4>
<p>seems like it might be a great addition to the rustc-dev-guide</p>



<a name="241535427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241535427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241535427">(Jun 04 2021 at 13:35)</a>:</h4>
<p>but also a good fit for inside rust?</p>



<a name="241535657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241535657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241535657">(Jun 04 2021 at 13:37)</a>:</h4>
<p>Just skimming, it does look it would be helpful for others :)</p>



<a name="241538135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241538135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241538135">(Jun 04 2021 at 13:55)</a>:</h4>
<p>sure, yeah</p>



<a name="241538175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241538175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241538175">(Jun 04 2021 at 13:55)</a>:</h4>
<p>agree with both things</p>



<a name="241538308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241538308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241538308">(Jun 04 2021 at 13:56)</a>:</h4>
<p>to be honest I'm not 100% sure if everything it says is correct, I'm about 95% sure :P</p>



<a name="241538394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241538394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241538394">(Jun 04 2021 at 13:57)</a>:</h4>
<p>but well, if we turn it into rustc-dev-guide and/or inside rust, more people would have the opportunity to review</p>



<a name="241849403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241849403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241849403">(Jun 07 2021 at 22:24)</a>:</h4>
<p>work is done here <a href="https://github.com/rust-lang/rust/issues/86118">#86118</a></p>



<a name="241849443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/241849443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#241849443">(Jun 07 2021 at 22:24)</a>:</h4>
<p>I still need to review myself, already went ahead and left a comment but there are a couple of things that doesn't convince me 100%, anyway, minor things :)</p>



<a name="242752305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242752305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242752305">(Jun 15 2021 at 15:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558/near/238527535">said</a>:</p>
<blockquote>
<p><div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">type</span> <span class="nc">X</span><span class="o">&lt;</span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Sized</span><span class="p">;</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">X</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div><br>
</p>
</blockquote>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>, we were discussing about this example with <span class="user-mention" data-user-id="232957">@Jack Huey</span>, can you explain exactly why should this be rejected?</p>



<a name="242752591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242752591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242752591">(Jun 15 2021 at 15:37)</a>:</h4>
<p>I have not a clear picture about it</p>



<a name="242752687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242752687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242752687">(Jun 15 2021 at 15:37)</a>:</h4>
<p>I'm thinking about it in a way that the type which impls Sized should contain or <code>A</code>, <code>B</code> or both of them but if the defining use is <code>X&lt;T, T&gt;</code> could be any so it's ambiguous</p>



<a name="242752732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242752732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242752732">(Jun 15 2021 at 15:37)</a>:</h4>
<p>but I'm a bit confused right now :)</p>



<a name="242782781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242782781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242782781">(Jun 15 2021 at 19:01)</a>:</h4>
<p>it's exactly what you said, <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> -- it's ambiguous</p>



<a name="242782796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242782796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242782796">(Jun 15 2021 at 19:01)</a>:</h4>
<p>should it be <code>type X&lt;A, B&gt; = A</code></p>



<a name="242782811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242782811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242782811">(Jun 15 2021 at 19:01)</a>:</h4>
<p>or should it be <code>type X&lt;A, B&gt; = B</code></p>



<a name="242782840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242782840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242782840">(Jun 15 2021 at 19:01)</a>:</h4>
<p>in this particular <em>usage</em> it doesn't make any difference, but there could be other uses where it would</p>



<a name="242782841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242782841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242782841">(Jun 15 2021 at 19:01)</a>:</h4>
<p>e.g.</p>



<a name="242782897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242782897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242782897">(Jun 15 2021 at 19:02)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">mod</span> <span class="nn">foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">type</span> <span class="nc">X</span><span class="o">&lt;</span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Sized</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">X</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">..</span><span class="p">.</span><span class="w"> </span><span class="n">X</span><span class="o">&lt;</span><span class="kt">u32</span><span class="p">,</span><span class="w"> </span><span class="kt">i32</span><span class="o">&gt;</span><span class="w"> </span><span class="o">..</span><span class="p">.</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="242782950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242782950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242782950">(Jun 15 2021 at 19:02)</a>:</h4>
<p>what is that <code>X&lt;u32, i32&gt;</code> an alias for?</p>



<a name="242785185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242785185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242785185">(Jun 15 2021 at 19:18)</a>:</h4>
<p>That example doesn't really make sense though?  That's essentially saying that <code>T = X&lt;T, T&gt;</code></p>



<a name="242787884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242787884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242787884">(Jun 15 2021 at 19:37)</a>:</h4>
<p>that seems fine</p>



<a name="242787895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242787895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242787895">(Jun 15 2021 at 19:37)</a>:</h4>
<p>I expect an error because of ambiguity</p>



<a name="242787906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242787906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242787906">(Jun 15 2021 at 19:37)</a>:</h4>
<p>but not because <code>X</code> is defined to be <code>T</code></p>



<a name="242788630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242788630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242788630">(Jun 15 2021 at 19:43)</a>:</h4>
<p>aren't you on vacation, <span class="user-mention" data-user-id="232957">@Jack Huey</span> :)</p>



<a name="242793409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242793409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242793409">(Jun 15 2021 at 20:19)</a>:</h4>
<p>Yes</p>



<a name="242793455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242793455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242793455">(Jun 15 2021 at 20:19)</a>:</h4>
<p><a href="/user_uploads/4715/0nzjTt9yTTQah8mP5mDjbhcR/image-41b16412-e42b-4508-a539-1c5184115e74.jpg">image-41b16412-e42b-4508-a539-1c5184115e74.jpg</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/0nzjTt9yTTQah8mP5mDjbhcR/image-41b16412-e42b-4508-a539-1c5184115e74.jpg" title="image-41b16412-e42b-4508-a539-1c5184115e74.jpg"><img src="/user_uploads/4715/0nzjTt9yTTQah8mP5mDjbhcR/image-41b16412-e42b-4508-a539-1c5184115e74.jpg"></a></div>



<a name="242794374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/TAIT%20PR%20%2382558/near/242794374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/TAIT.20PR.20.2382558.html#242794374">(Jun 15 2021 at 20:25)</a>:</h4>
<p>between strike and strike you fix some rustc problems? <span aria-label="clap" class="emoji emoji-1f44f" role="img" title="clap">:clap:</span> <span aria-label="clap" class="emoji emoji-1f44f" role="img" title="clap">:clap:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>